from django.utils.translation    import ugettext_lazy as _
from sitepal.sitetheme.renderers import BlockRenderer

class WelcomeBlockRenderer(BlockRenderer):
    def render_content(self,request):
        if self.get_user(request).is_authenticated():
            profile = self.render_link(url       ='/user/profile',
                                       resolve   ='menu',
                                       content   =context['username'],
                                       attributes={'title':_("Welcome")})
            logout  = self.render_link(url       ='/user/logout',
                                       resolve   ='menu',
                                       content   =_("log out"),
                                       attributes={'title':_("log out")})
            return self.render_welcome_user(profile,logout,_("Welcome"),request)
        else:
            login = self.render_link(url       ='/user/login',
                                     resolve   ='menu',
                                     content   =_("log in"),
                                     attributes={'title':_("log in")})
            return self.render_welcome_login(login,request=request)

